package com.lingkang.dbtodoc.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;

/**
 * @author 绫小路
 * @date 2021/1/31 23:25
 * @description
 */
@Controller
public class FilterConfig {

  @Autowired
  private AuthFilter authFilter;

  @Bean
  public FilterRegistrationBean AuthFilterBean(){
    FilterRegistrationBean bean=new FilterRegistrationBean();
    bean.addUrlPatterns("/main/*");//注意，不能使用/**两个 * 号
    bean.setName("AuthFilterBean");
    bean.setOrder(1);//越小优先级越高
    bean.setFilter(authFilter);
    return bean;
  }
}
